/**
 * 
 */
angular.module('app.service.user', ['ngResource'])

//user
    .service('UserService', ['$resource', function ($resource) {
        var resource = $resource(localhost + "user/:userid", {}, {
            get: {cache: true, method: 'GET'}
        });
        //通过id,获取
        this.getuserbyid = function (id) {
            return resource.get({userid: id});
        }
        //通过name,获取
        this.getuserbyname = function (name) {
            var resource = $resource(localhost + "user/byname/:name");
            return resource.get({name: name});
        }
    }])

//联系人
    .service('UserContactService', ['$resource', function ($resource) {
        var resource = $resource(localhost + "user_contact/:contactid", {}, {
            get: {cache: true, method: 'GET'}
        });
        //通过id,获取
        this.getusercontactbyid = function (id) {
            return resource.get({contactid: id});
        }
    }])
;